<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
</head>
<body>
<script>
    var timer = new Date('2016-06-07 12:00:10');
    console.log(timer);
    console.log(timer.getFullYear());
    console.log(timer.getMonth());//月份0-11
    console.log(timer.getDay());//0周日 1-6周一-周六

    //获得好秒数
    console.log(timer.getTime());//1465272010000

//    倒计时:

    var further = new Date('2016-07-14 00:00:00');
    var furtherSecond = further.getTime();

    var now = new Date();
    var nowSecond = now.getTime();
    console.log(now,nowSecond);
    var disTime = furtherSecond - nowSecond;
    console.log(disTime);
//    1000毫秒 = 1秒
//    60秒 = 1分钟
//    60分钟 = 1小时
//    24小时 = 1天
//    1天 = 1000*60*60*24;
//    disTime===>几天 几小时 几分钟 几秒
    var day = parseInt(disTime/(1000*60*60*24));
    console.log(day);
//    获得刨除掉天数占用的毫米数以外剩下的豪秒数,用它来计算剩余的小时数.
    disTime = disTime - day*1000*60*60*24;
    var hour = parseInt(disTime/(1000*60*60));
    console.log(hour);
    disTime = disTime - hour*1000*60*60;
    var minute = parseInt(disTime/(1000*60));
    console.log(minute);
    disTime = disTime - minute*1000*60;
    var seconds = parseInt(disTime/1000);
    console.log(seconds);







</script>
</body>


















</html>